
REM @echo off

path %path%;.\wbin;.\storclient;

REM 1800 sec = 30 min, let storoom work & wait for new frontdoor generated
sleep 1800

set frontdoorlogpath=..\..\log\frontdoor\
set fdlog=frontdoor
set fdtestlog=frontdoor.test
set fdperflog=frontdoor.perf

set log=%fdlog%
call :uploader

set log=%fdtestlog%
call :uploader

set log=%fdperflog%
call :uploader

goto :finish

:uploader
set selector=frontdoor*_%log%_*
for /f %%x in ('dir /b /o d "%frontdoorlogpath%%selector%" ^| linew /-') do set /a __FRONTDOOR_LOG_COUNT__=%%x-1

for /f %%x in ('dir /b /o d "%frontdoorlogpath%%selector%" ^| select -r 0^,%__FRONTDOOR_LOG_COUNT__% /- /-') do (
    storclient -host hzj-jie-8320-1 -port 42312 -serialWrite -key %log%.log -i "%frontdoorlogpath%%%x" ^&
    rename "%frontdoorlogpath%%%x" "uploaded.%%x" )

goto :eof

:finish

sleep 300

